package com.zl.zsk.repository;

import com.zl.zsk.pojo.SysMenu;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author lxb
 * @version 1.0.0
 * @desc: 菜单数据访问层
 * @date 2020-03-13 11:01
 */
public interface SysMenuRepository extends JpaRepository<SysMenu,Long> {
    @Query(value = "select * from sys_user a " +
            " join sys_user_role b on a.user_id = b.user_id " +
            " join sys_role_menu c on b.role_id = c.role_id " +
            " join sys_menu d on c.menu_id = d.menu_id " +
            " where a.login_name = ?1 ",nativeQuery = true)
    List<SysMenu> findSysMenusByLoginName(String loginName);
}
